#include <iostream>
#include <cstring>
using namespace std;


void encryption(){
	string user;
	cout<<"document name?\n:";
	cin>>user;
	FILE *fin,*fout;
	fin = fopen(user.c_str(),"r");
	fout = fopen("encryption.txt","w");
	string enc="";
	fscanf(fin,"%s<end>",enc.c_str());
	cout<<"start working(i="<<enc.length()<<")"<<endl;
	for(int i=0;i<enc.length();i++){
		fprintf(fout,"%c",enc[i]+1);
		cout<<"handling:"<<i<<endl;
	}
	fclose(fin);
	fclose(fout);
	return;
}

void deciphering(){
	string user;
	cout<<"document name?\n:";
	cin>>user;
	FILE *fin,*fout;
	fin = fopen(user.c_str(),"r");
	fout = fopen("deciphering.txt","w");
	string enc="";
	fscanf(fin,"%s<end>",enc.c_str());
	for(int i=0;i<enc.length();i++){
		fprintf(fout,"%c",enc[i]-1);
		cout<<"handle:"<<i<<endl;
	}
	fclose(fin);
	fclose(fout);
	return;
}


int main(){
	cout<<"encryption or deciphering?\n:";
	char user;
	cin>>user;
	if(user == 'e')
		encryption();
	else if(user == 'd')
		deciphering();
	return 0;
}
